/*
 * @Description:
 * @version:
 * @Author: sunqian_sr
 * @Date: 2022-12-12 17:03:51
 * @LastEditors: Andy
 * @LastEditTime: 2023-03-01 09:24:26
 */
import { MessageBox } from 'element-ui'

import { pinias } from '@/common/pinia'

export const serviceConfig = {
  tokenExpirationCb: () => {
    const { login } = pinias
    const userLogin = login()
    MessageBox.confirm('登录状态已过期，您可以继续留在该页面，或者重新登录', '系统提示', {
      confirmButtonText: '重新登录',
      cancelButtonText: '取消',
      type: 'warning'
      // center: true
    })
      .then(async () => {
        console.log('失效token')
        location.href = '/home'
        userLogin.clearUserInfo()
      })
      .catch(() => {})
  },
  noAuthorityCb: () => {}
}
